<?php

global $WSC;

require_once('tcms_vpt_page_wp.class.php');


class TCMS_VPT_301_WP extends TCMS_VPT_Page_WP {
	function __construct(TCMS_VPage_DBC $vpage, TCMS_VPage_Template_DBC $vpt) {
		parent::__construct($vpage, $vpt, 'tcms_vpt_301_page');
	}


	protected function default_event() {
		$dbc = $this->get_dbc();

		$location = current(TCMS_VPage_System_Attribute_DBC::load_all_by_sa_export_name_vpage($dbc, 'location', $this->get_vpage()->get_id()));

		$view = new Just_Headers_View();
		$view->add_http_header('HTTP/1.1 301 Moved Permanently');
		$view->add_http_header('Location: '.$location->get_value());

		return $view;
	}
}
